Skip to content

build: upgrade to TypeScript 7#8167

Open
joshblack wants to merge 4 commits into
mainfrom
upgrade-typescript-7
Open

build: upgrade to TypeScript 7#8167
joshblack wants to merge 4 commits into
mainfrom
upgrade-typescript-7

Conversation

@joshblack

Copy link
Copy Markdown
Member

No linked issue.

This PR updates the repository to use the TypeScript 7 native compiler while keeping TypeScript 6 available for tools that still depend on the compiler API.

Changelog

New

  • Add TypeScript 7.0.2 as the @typescript/native development dependency so tsc uses the native compiler.

Changed

  • Update workspace TypeScript dependencies to use the @typescript/typescript6 compatibility package for API-based tooling such as typescript-eslint.
  • Update the ActionList.TrailingAction type suppressions for TypeScript 7's diagnostic locations.

Removed

  • Remove the TypeScript 6-only stableTypeOrdering compiler option.

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; this updates our internal development tooling and has no public-facing impact.

Testing & Reviewing

  • Confirm tsc resolves to TypeScript 7.0.2 and tsc6 remains available through the compatibility package.
  • Confirm type-checking, tests, linting, formatting, and builds complete with the side-by-side setup.

Migration guidance:

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 90be1f51-4a09-4876-b773-8e5d9cf27399
Copilot AI review requested due to automatic review settings July 15, 2026 16:33
@joshblack
joshblack requested a review from a team as a code owner July 15, 2026 16:33
@joshblack
joshblack requested a review from liuliu-dev July 15, 2026 16:33
@joshblack joshblack added the skip changeset This change does not need a changelog label Jul 15, 2026
@changeset-bot

changeset-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: a30914a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added the staff Author is a staff member label Jul 15, 2026
@github-actions github-actions Bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Jul 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. If this doesn't work, you can also use the original workflow here. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

To publish a canary release for integration testing, apply the Canary Release label to this PR.

@joshblack joshblack left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot the majority of this upgrade should be moving typescript to v7. Only one package should need to stay on v6/use a v6 package and that is doc-gen. Make updates accordingly

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the repo’s TypeScript toolchain to run tsc using the TypeScript 7 native compiler while keeping TypeScript 6 available for compiler-API consumers via the @typescript/typescript6 compatibility package.

Changes:

  • Added @typescript/native (aliased to typescript@^7.0.2) so tsc can use the TS 7 native compiler.
  • Switched workspace typescript devDependencies to npm:@typescript/typescript6@^6.0.2 for TS 6 compiler API compatibility.
  • Adjusted ActionList.TrailingAction @ts-expect-error placement to match TS 7 diagnostic locations.
  • Removed the TS 6-only stableTypeOrdering compiler option.
Show a summary per file
File Description
tsconfig.base.json Removes stableTypeOrdering now that TS 7 is in use.
package.json Adds @typescript/native and re-points typescript to the TS6 compatibility package.
package-lock.json Locks new TS7 native compiler and TS6 compatibility dependencies.
packages/react/package.json Uses the TS6 compatibility package for tooling that depends on compiler APIs.
packages/styled-react/package.json Uses the TS6 compatibility package for tooling that depends on compiler APIs.
packages/rolldown-plugin-preserve-directives/package.json Uses the TS6 compatibility package for tooling that depends on compiler APIs.
packages/rolldown-plugin-import-css/package.json Uses the TS6 compatibility package for tooling that depends on compiler APIs.
packages/react-compiler-check/package.json Uses the TS6 compatibility package for tooling that depends on compiler APIs.
packages/postcss-preset-primer/package.json Uses the TS6 compatibility package for tooling that depends on compiler APIs.
packages/mcp/package.json Uses the TS6 compatibility package for tooling that depends on compiler APIs.
packages/doc-gen/package.json Uses the TS6 compatibility package for tooling that depends on compiler APIs.
packages/canvas/package.json Uses the TS6 compatibility package for tooling that depends on compiler APIs.
examples/theming/package.json Uses the TS6 compatibility package for tooling that depends on compiler APIs.
examples/nextjs/package.json Uses the TS6 compatibility package for tooling that depends on compiler APIs.
examples/codesandbox/package.json Uses the TS6 compatibility package for tooling that depends on compiler APIs.
packages/react/src/ActionList/TrailingAction.tsx Updates @ts-expect-error placement for TS 7 diagnostics.

Review details

  • Files reviewed: 15/16 changed files
  • Comments generated: 0
  • Review effort level: Low

…mpat

- Update root package.json to restore @typescript/native alias (TypeScript 7 for tsc)
  while keeping `typescript: @typescript/typescript6` for eslint and rolldown-plugin-dts
- Update all workspace packages except doc-gen to use typescript: "^7.0.2"
- Keep packages/doc-gen on @typescript/typescript6 (runtime TypeScript compiler API)
- Add @typescript/typescript6 devDep to styled-react and update its deprecated-exports
  test to import from @typescript/typescript6 (the test uses the TypeScript compiler API)
- Update examples to use typescript: "^7.0.2"

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>

Copilot AI commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@copilot the majority of this upgrade should be moving typescript to v7. Only one package should need to stay on v6/use a v6 package and that is doc-gen. Make updates accordingly

Done in commit build: move workspace packages to TypeScript 7, keep doc-gen on v6 compat.

All workspace packages (canvas, mcp, postcss-preset-primer, react, react-compiler-check, rolldown-plugin-import-css, rolldown-plugin-preserve-directives, examples) now use typescript: "^7.0.2". doc-gen stays on npm:@typescript/typescript6@^6.0.2 since it uses the TypeScript compiler API at runtime.

Two notes on the root and styled-react:

  • Root still has the dual setup (@typescript/native → TS7 binary for tsc, typescript@typescript/typescript6 for eslint/rolldown-plugin-dts). TypeScript 7's typescript package no longer exposes the compiler API (ts.sys, ts.createProgram, etc.), so typescript-eslint@8.x (peer dep <6.1.0) and rolldown-plugin-dts@0.26 both need the v6 compat package at root. node_modules/.bin/tsc resolves to TypeScript 7.0.2 via the @typescript/native alias.

  • packages/styled-react has a deprecated-exports.test.ts that also uses the TypeScript compiler API. Rather than putting the whole package back on v6, I added "@typescript/typescript6": "^6.0.2" as a devDependency and changed the import in the test to @typescript/typescript6 explicitly, keeping typescript: "^7.0.2" as the main TypeScript for the package.

Comment thread package.json
Comment thread packages/react/src/ActionList/TrailingAction.tsx
…omment

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>

@joshblack joshblack left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot fix CI

… compatibility

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>

Copilot AI commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@copilot fix CI

Fixed in commit fix: use @typescript/typescript6 in Next.js examples for compiler API compatibility.

The CI failure was in example-theming#build (and would also have failed in example-nextjs): TypeScript 7's typescript@7.x package only exports a version file (lib/version.cjs) — it doesn't include the traditional JS compiler API (ts.createProgram, etc.) that Next.js uses internally for type checking. When Next.js tries require('typescript') and finds no API methods, it reports "TypeScript not installed."

examples/theming and examples/nextjs now use typescript: "npm:@typescript/typescript6@^6.0.2" (same alias pattern as the root package.json), so they resolve to the TS6 compat package with the full API. examples/codesandbox only runs tsc directly and continues to use TypeScript 7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm skip changeset This change does not need a changelog staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants